package com.zte.stats.control;

import com.zte.stats.dao.IStatsPurchaseDao;
import com.zte.stats.model.*;
import com.zte.stats.service.IStatsPurchaseService;
import com.zte.stats.service.IStatsSalesService;
import com.zte.util.PageModel;
import com.zte.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/purchase")

public class StatsPurchaseAction {

    @Autowired
    private IStatsPurchaseService iStatsPurchaseService;

    @RequestMapping("/cfirm")
    @ResponseBody
    public ResultMessage queryCFirmListByCondition(PageModel<StatsCFirm> pageModel, StatsPurchaseCondition spc) {
        PageModel<StatsCFirm> statsCFirmPageModel = iStatsPurchaseService.queryCFirmListByCondition(pageModel, spc);
        ResultMessage msg = new ResultMessage();
        msg.setStatus(200);
        msg.setFlag(true);
        msg.setMsg("查询厂商成功！");
        msg.setData(statsCFirmPageModel);
        return msg;
    }

    @RequestMapping("/cproduct")
    @ResponseBody
    public ResultMessage queryCProductListByCondition(PageModel<StatsCPurchase> pageModel, StatsPurchaseCondition spc) {
        PageModel<StatsCPurchase> statsCProductPageModel = iStatsPurchaseService.queryProductListByCondition(pageModel, spc);
        ResultMessage msg = new ResultMessage();
        msg.setStatus(200);
        msg.setFlag(true);
        msg.setMsg("查询商品成功！");
        msg.setData(statsCProductPageModel);
        return msg;
    }

}
